//
//  DetailMemberCell.m
//  BigToBig
//
//  Created by liuyi on 7/20/16.
//  Copyright © 2016 cn.cloudtp. All rights reserved.
//

#import "DetailMemberCell.h"

@implementation DetailMemberCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
        
    }
    return self;
}

- (void)createSubViews{
    //  头像
    self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, (kScreenWidth - 20)/6, (kScreenWidth - 20)/6)];
    self.headImageView.image = [UIImage imageNamed:@"touxiang"];
    [self addSubview:self.headImageView];
    self.headImageView.layer.cornerRadius = (kScreenWidth - 20)/12;
    self.headImageView.layer.masksToBounds = YES;
    
    // 分类名
    UILabel *groupLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.headImageView.x, self.headImageView.maxY + 5, self.headImageView.width, self.headImageView.height / 3)];
    groupLabel.backgroundColor = COLOR_RGBA(0, 228, 161, 1);
    groupLabel.text = @"创始人";
    groupLabel.font = [UIFont systemFontOfSize:12];
    groupLabel.textAlignment = 1;
    groupLabel.textColor = [UIColor whiteColor];
    groupLabel.layer.cornerRadius = 5;
    groupLabel.layer.masksToBounds = YES;
    [self addSubview:groupLabel];
    
    // 标题
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.headImageView.maxX + 10, self.headImageView.y + 5, kScreenWidth - self.headImageView.maxX - 10, self.headImageView.height /3)];
    [self addSubview:self.titleLabel];
    self.titleLabel.textAlignment = NSTextAlignmentLeft;
    
    // 描述
    self.describeLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.titleLabel.x, self.titleLabel.maxY , self.titleLabel.width, self.height - self.titleLabel.maxY - 10)];
    [self addSubview:self.describeLabel];
    self.describeLabel.numberOfLines = 0;
    self.describeLabel.font = [UIFont systemFontOfSize:12];
    self.describeLabel.textColor = [UIColor lightGrayColor];
    

}

- (void)layoutSubviews{
    self.describeLabel.frame = CGRectMake(self.titleLabel.x, self.titleLabel.maxY , self.titleLabel.width - 10, self.height - self.titleLabel.maxY - 10);
    UILabel *lineLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.height - 1, kScreenWidth, 1)];
    lineLabel.backgroundColor = COLOR_RGBA(247, 247, 247, 1);
    [self.contentView addSubview:lineLabel];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
